//
//  ECSystemNotiCell.m
//  Edu_iOS2018
//
//  Created by apple on 2018/1/16.
//  Copyright © 2018年 yanyan. All rights reserved.
//

#import "ECSystemNotiCell.h"

#import "ECSystemNotiModel.h"

@interface ECSystemNotiCell(){
    
    UILabel *contentlab;
    UILabel *timeLab;
}

@end

@implementation ECSystemNotiCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = 0;
        [self setCellUI];
    }
    return self;
}

-(void)setCellUI{
    contentlab= [[UILabel alloc]init];
    [self.contentView addSubview:contentlab];
    contentlab.textColor = [UIColor colorWithHexString:@"#333333"];
    contentlab.numberOfLines = 0;
    contentlab.font = [UIFont systemFontOfSize:15*kPercentage];
    
    timeLab = [[UILabel alloc]init];
    [self.contentView addSubview:timeLab];
    timeLab.textColor = [UIColor colorWithHexString:@"#b3b3b3"];
    
    UIView *lineView = [[UIView alloc]init];
    [self.contentView addSubview:lineView];
    lineView.backgroundColor = [UIColor colorWithHexString:@"#E5E5E5"];
    
    WeakSelf(weakSelf);
    [contentlab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.contentView.mas_left).offset(kProportion_Width(40));
        make.top.equalTo(weakSelf.contentView.mas_top).offset(kProportion_Height(40));
        make.right.equalTo(weakSelf.contentView.mas_right).offset(-kProportion_Width(40));
        make.bottom.equalTo(timeLab.mas_top).offset(-kProportion_Height(40));
    }];
    
    [timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(contentlab.mas_left);
        make.top.equalTo(contentlab.mas_bottom).offset(kProportion_Height(40));
        make.height.equalTo(@17);
        make.width.equalTo(@200);
    }];
    
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(weakSelf.mas_bottom);
        make.width.equalTo(contentlab.mas_width);
        make.left.equalTo(contentlab.mas_left);
        make.height.equalTo(@1);
    }];
}

-(void)setContentMode:(ECSystemNotiModel *)contentMode{
    contentlab.text = contentMode.title;
    timeLab.text = contentMode.createdTime;
}


@end
